import request from "@/utils/request";

export const add = (params) => {
  const { date, trainCode, index, seatType, seatCount, rowCount, colCount } =
    params;
  return request.post("/daily-train/admin/train-carriage/add", {
    date,
    trainCode,
    index,
    seatType,
    seatCount,
    rowCount,
    colCount,
  });
};

export const getPage = (pageNo, pageSize, search) => {
  const { date, code } = search;
  return request.post("/daily-train/admin/train-carriage/page", {
    pageNo,
    pageSize,
    date,
    code,
  });
};

export const remove = (id) => {
  return request.delete(`/daily-train/admin/train-carriage/remove/${id}`);
};

export const edit = (params) => {
  const {
    id,
    date,
    trainCode,
    index,
    seatType,
    seatCount,
    rowCount,
    colCount,
  } = params;
  return request.post("/daily-train/admin/train-carriage/edit", {
    id,
    date,
    trainCode,
    index,
    seatType,
    seatCount,
    rowCount,
    colCount,
  });
};
